package util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class PropertyManager {
	private static Properties props = new Properties();
	private static Map<String, PropertyManager> map = new HashMap<String, PropertyManager>();
	
	public String getProperty(String key) {
		return props.getProperty(key);
	}

	private PropertyManager(String propertyName) {
		try {
			props.load(new FileInputStream(propertyName));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static synchronized PropertyManager getManager(String identifier) {
		if (map.get(identifier) == null) {
			map.put(identifier, new PropertyManager(identifier));
		}
		return map.get(identifier);
	}
}
